package ooday02;
/**
 * 方法重写的测试类
 */
public class OverrideDemo {
    public static void main(String[] args) {
        //重写方法被调用时，看对象的类型执行方法（new谁就调谁）
        Student zl=new Student("张三",39,"山东","jsd2407","003");
        zl.sayHi();//调用Student重写之后的
        Teacher ll=new Teacher("李亮",40,"山东",4000.0);
        ll.sayHi();//调用Teacher重写之后的
        Doctor wpf=new Doctor("王鹏飞",30,"山东","无");
        wpf.sayHi();//调用Person中的
    }
}
